package com.baidu.lib_home.adapter

import androidx.recyclerview.widget.GridLayoutManager
import com.baidu.lib_common.base.BaseRecyclerViewAdapter
import com.baidu.lib_home.databinding.ChartItemBinding
import com.baidu.lib_leancloud.model.Chart
import com.baidu.lib_leancloud.model.ChartMusicModel

class ChartAdapter: BaseRecyclerViewAdapter<ChartItemBinding,ChartMusicModel>() {
    override fun bindData(binding: ChartItemBinding, data: ChartMusicModel) {
        binding.chartName.text = data.title
        val adapter = MusicAdapter()
        binding.recyclerView.adapter = adapter
        binding.recyclerView.layoutManager = GridLayoutManager(
            binding.root.context,
            3,
            GridLayoutManager.HORIZONTAL,
            false
        )
        adapter.setNewData(data.music)
    }
}